// SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
// SPDX-License-Identifier: Mulan PSL v2
package com.geniusai.aip.auth.service;

import com.geniusai.aip.auth.domain.Profile;

import java.io.IOException;

/**
 * @author hml14563
 * @date 2021/5/6
 */
public interface ProfileService {
    /**
     * 创建一个profile
     * 
     * @param profile profile object
     * @throws IOException
     */
    void createProfile(Profile profile) throws IOException;

    /**
     * 删除一个profile
     * 
     * @param username namespace
     * @throws IOException
     */
    void deleteProfile(String username) throws IOException;

    /**
     * 更新一个profile
     * 
     * @param profile
     * @throws IOException
     */
    void updateProfile(Profile profile) throws IOException;

    /**
     * 创建一个secret
     * 
     * @param secretName the name of the secret
     * @param username   namespace of the user
     * @param accessKey  the access key of the minio
     * @param secretKey  the secret key of the minio
     */
    void createSecret(String secretName, String username, String accessKey, String secretKey);

    /**
     * 创建一个MysqlSecret（用于kale与MySQL通信）
     * 
     * @param secretName the name of the secret
     * @param username   namespace of the user
     */
    void createMysqlSecret(String secretName, String username);

    /**
     * 用户创建时添加kale与kubeflow通信的Role RoleBinding信息
     * 
     * @param roleName 角色名称
     * @param username namespace of the user
     */
    void createUserRole(String roleName, String username);

    /**
     * 创建一个带有指定secretName的SA
     * 
     * @param saName     the name of the serviceAccount
     * @param username   namespace of the user
     * @param secretName the name of the secret
     */
    void createServiceAccount(String saName, String username, String secretName);
}
